package service;

import java.io.*;
import java.util.Date;

public class Journal {

    public static void record(String ...args) throws IOException {
       BufferedWriter writer = new BufferedWriter(new FileWriter("src//src//File//journal.txt",true));
        Date date=new Date();
        StringBuilder s=new StringBuilder();
        for(int i=0;i<args.length;i++){
            s.append(args[i]);
        }
        writer.write(date.toString()+"-----"+s.toString());
        writer.newLine();
        writer.close();
    }

    public static void getRecord() throws IOException {
        BufferedReader bufferedReader=new BufferedReader(new FileReader("src//src//File//journal.txt"));
        String line=null;
        while ((line=bufferedReader.readLine())!=null){
            System.out.println(line);
        }
//        char[] chars=new char[1024];
//        int len=0;
//        while ((len=fileReader.read(chars))!=-1){
//           String str=new String(chars,0,len);
//            System.out.println(str);
//        }
//        fileReader.close();
    }


    public static void main(String[] args) throws IOException {
             record("ggb");
             record("vvd");
             getRecord();
    }
}
